# Contributor: Danct12 <danct12@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtwebview
pkgver=5.15.5_git20220602
pkgrel=0
_commit="429096eb954672d3727a3e8cc83832bc79cf7967"
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine
# armhf blocked by qt5-qtdeclarative
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://www.qt.io/developers/"
license="LGPL-3.0-only AND GPL-2.0-only AND GPL-3.0-only AND Qt-GPL-exception-1.0"
pkgdesc="Provides a way to display web content in a QML application"
depends="qt5-qtwebengine"
depends_dev="qt5-qtdeclarative-dev"
makedepends="$depends_dev
	qt5-qtbase-dev
	"
subpackages="$pkgname-dev"
builddir="$srcdir/qtwebview-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtwebview/-/archive/$_commit/qtwebview-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5 CONFIG+="lang-all handwriting"
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
bdd2392ea50972fb735104934a17b7cc726cb0e9127bad121446f65ee12890f2ac5ff484f8b123a08adb514a0c0bb06f096a6b2cc0d15a52c7daffed7cab45a7  qtwebview-429096eb954672d3727a3e8cc83832bc79cf7967.tar.gz
"
